package Aggregation;

public class Test {
	public static void main(String[] args) {
		// First to create a friendly lecture.
		Lecture lecture1 = new Lecture("First lecture");
		// Create a module and add the lecture to a Module.
		Module module1 = new Module("Module 1", lecture1);
		// Create 7 lectures and add them to module1.
		for (int i=0; i < 7; ++i) {
			String lectureName = "Lecture " + i;
			 module1.addLecture(new Lecture(lectureName));
		}
		
		// Test that a module can't contain 9 lectures.
		Lecture extraLecture = new Lecture("One too many");
		module1.addLecture(extraLecture);
		
		// Create an array of 8 lectures to test the Module.addLectures method.
		Lecture[] lectureSet1 = new Lecture[8];
		for (int i=0; i < 8; ++i) {
			String lectureName = "Lecture " + i;
			lectureSet1[i] = new Lecture(lectureName);
		}
		// This will return with a fail message.
		Module module2 = new Module("Module 2", lectureSet1);
		
		// Create a diploma and add the modules to it.
		DiplomaPG diploma1 = new DiplomaPG("Diploma 1");
		diploma1.addModule(module1);
		diploma1.addModule(module2);
		
		// Create 4 more modules and add them to the diploma1.
		Module module3 = new Module("Module 3", lectureSet1);
		diploma1.addModule(module3);
		Module module4 = new Module("Module 4", lectureSet1);
		diploma1.addModule(module4);
		Module module5 = new Module("Module 5", lectureSet1);
		diploma1.addModule(module5);
		Module module6 = new Module("Module 6", lectureSet1);
		diploma1.addModule(module6);
		
		// Test that a diploma can't contain 7 modules.
		Module extraModule = new Module("One too many", lectureSet1);
		diploma1.addModule(extraModule);
		
		diploma1.printDetails();
		
		// Test the second Diploma constructor with an array of Modules.
		Module[] moduleSet = new Module[6];
		for (int i=0; i < 6; ++i) {
			String moduleName = "ModuleSet Module " + (i+1);
			moduleSet[i] = new Module(moduleName, lectureSet1);
		}
		// Create diploma 2 with moduleSet.
		DiplomaPG diploma2 = new DiplomaPG("Diploma 2", moduleSet);
		
		diploma2.printDetails();
	}

}